# Maintainer: JackNapier <jacknapier151@gmail.com>
# Contributor: 

##########
# Godot4 #
##########
pkgname=(
	"godot4-alpha-src"
	##################
	# Godot GDScript #
	##################
	"godot4-alpha-bin"
	"godot4-alpha-bin32"
	"godot4-alpha-export-templates-bin"
	"libgodot4-alpha-bin"
	"godot4-alpha-osx-bin"
	"godot4-alpha-win32-bin"
	"godot4-alpha-win64-bin"
	"godot4-alpha-android-bin"
	)
_pkgver="4.0"
_pkgverb=17
#pkgver="${_pkgver}alpha${_pkgverb}"
pkgver="${_pkgver}a${_pkgverb}"
pkgrel=1
pkgdesc="Godot4 Game Engine: An advanced, feature packed, multi-platform 2D and 3D game engine."
url="http://www.godotengine.org"
license=("MIT")
groups=(
	"godot-full"
	"godot4"
	"godot40"
	"godot-bin"
	"godot-alpha"
	"godot-gdscript"
)
arch=("any")
_monodepends=(
	"mono>=6.12.0"
	"dotnet-sdk"
	"msbuild"
)
depends=(
	"godot-base"
	"alsa-lib"
	"freetype2"
	"glu"
	"libxcursor"
	"libxinerama"
	"mesa"
)

source=("https://downloads.tuxfamily.org/godotengine/${_pkgver}/alpha${_pkgverb}/godot-${_pkgver}-alpha${_pkgverb}.tar.xz")
sha512sums=("SKIP")
package_godot4-alpha-src(){
	pkgdesc+=" Alpha SourceCode"
	groups+=(
		"godot-src"
	)
	install -d "${pkgdir}/opt/godot/src/godot4-alpha/"
	cp -r "${srcdir}/godot-${_pkgver}-alpha${_pkgverb}/"* "${pkgdir}/opt/godot/src/godot4-alpha/"
}

##################
# Godot GDScript #
##################

source+=("https://downloads.tuxfamily.org/godotengine/${_pkgver}/alpha"${_pkgverb}"/Godot_v${_pkgver}-alpha"${_pkgverb}"_linux.x86_64.zip")
sha512sums+=("SKIP")
package_godot4-alpha-bin(){
	pkgdesc+=" Alpha Binary Version"
	groups+=(
		"godot-standard"
		"godot-standard64"
		"godot-64"
	)
	install -Dm755 "${srcdir}/Godot_v${_pkgver}-alpha${_pkgverb}_linux.x86_64" "${pkgdir}/opt/godot/godot4-alpha-bin"
	
	install -d "${pkgdir}/usr/bin/"
	ln -s "/opt/godot/godot4-alpha-bin" "${pkgdir}/usr/bin/godot4-alpha-bin"
	
	install -d "${pkgdir}/usr/share/applications/"
	cat > "${pkgdir}/usr/share/applications/godot4-alpha-bin.desktop" <<-EOF
		[Desktop Entry]
		Name=Godot4 Engine Alpha Binary v${_pkgver}-alpha${_pkgverb}
		GenericName="Advanced cross-platform 2D and 3D libre game engine. Alpha Binary Version"
		Comment=Application for making games
		Exec=/usr/bin/godot4-alpha-bin %U
		Icon=godot
		Terminal=false
		Type=Application
		MimeType=application/x-godot-project;
		Categories=Development;IDE;
	EOF
	
}


source+=("https://downloads.tuxfamily.org/godotengine/${_pkgver}/alpha${_pkgverb}/Godot_v${_pkgver}-alpha${_pkgverb}_linux.x86_32.zip")
sha512sums+=("SKIP")
package_godot4-alpha-bin32(){
	pkgdesc+=" Alpha Binary Version 32b"
	groups+=(
		"godot-standard"
		"godot-standard32"
		"godot-32"
	)
	install -Dm755 "${srcdir}/Godot_v${_pkgver}-alpha${_pkgverb}_linux.x86_32" "${pkgdir}/opt/godot/godot4-alpha-bin32"
	
	install -d "${pkgdir}/usr/bin/"
	ln -s "/opt/godot/godot4-alpha-bin32" "${pkgdir}/usr/bin/godot4-alpha-bin32"
	
	install -d "${pkgdir}/usr/share/applications/"
	cat > "${pkgdir}/usr/share/applications/godot4-alpha-bin32.desktop" <<-EOF
		[Desktop Entry]
		Name=Godot4 Engine Alpha Binary v${_pkgver}-alpha${_pkgverb} 32b
		GenericName="Advanced cross-platform 2D and 3D libre game engine. Alpha Binary Version 32b"
		Comment=Application for making games
		Exec=/usr/bin/godot4-alpha-bin32 %U
		Icon=godot
		Terminal=false
		Type=Application
		MimeType=application/x-godot-project;
		Categories=Development;IDE;
	EOF
}

source+=("https://downloads.tuxfamily.org/godotengine/${_pkgver}/alpha${_pkgverb}/Godot_v${_pkgver}-alpha${_pkgverb}_export_templates.tpz")
noextract=("Godot_v${_pkgver}-alpha${_pkgverb}_export_templates.tpz")
sha512sums+=("SKIP")
package_godot4-alpha-export-templates-bin(){
	pkgdesc+=" Alpha Export Templates Binary Version"
	groups+=(
		"godot-export-templates"
	)
	install -Dm755 "${srcdir}/Godot_v${_pkgver}-alpha${_pkgverb}_export_templates.tpz" "${pkgdir}/opt/godot/godot4-alpha-export-templates-bin.tpz"
}

source+=("https://downloads.tuxfamily.org/godotengine/${_pkgver}/alpha${_pkgverb}/godot-lib.${_pkgver}.alpha${_pkgverb}.release.aar")
noextract+=("godot-lib.${_pkgver}.alpha${_pkgverb}.release.aar")
sha512sums+=("SKIP")
package_libgodot4-alpha-bin(){
	pkgdesc+=" Alpha LibGodot Binary Version"
	groups+=(
		"godot-lib"
	)
	install -Dm755 "${srcdir}/godot-lib.${_pkgver}.alpha${_pkgverb}.release.aar" "${pkgdir}/opt/godot/godot-lib/libgodot4-alpha-bin.aar"
}

source+=("https://downloads.tuxfamily.org/godotengine/${_pkgver}/alpha${_pkgverb}/Godot_v${_pkgver}-alpha${_pkgverb}_macos.universal.zip")
sha512sums+=("SKIP")
package_godot4-alpha-osx-bin(){
	pkgdesc+=" Alpha MacOSX Binary Version"
	groups+=(
		"godot-osx"
		"godot-osx-universal"
	)
	install -Dm755 "${srcdir}/Godot.app/Contents/MacOS/Godot" "${pkgdir}/opt/godot/godot4-alpha-osx-bin"
}

source+=("https://downloads.tuxfamily.org/godotengine/${_pkgver}/alpha${_pkgverb}/Godot_v${_pkgver}-alpha${_pkgverb}_win32.exe.zip")
sha512sums+=("SKIP")
package_godot4-alpha-win32-bin(){
	pkgdesc+=" Alpha Windows Binary Version 32b"
	groups+=(
		"godot-win"
		"godot-win32"
		"godot-32"
	)
	install -Dm755 "${srcdir}/Godot_v${_pkgver}-alpha${_pkgverb}_win32.exe" "${pkgdir}/opt/godot/godot4-alpha-win32-bin.exe"
	install -Dm755 "${srcdir}/Godot_v${_pkgver}-alpha${_pkgverb}_win32_console.cmd" "${pkgdir}/opt/godot/godot4-alpha-win32-bin.cmd"
}

source+=("https://downloads.tuxfamily.org/godotengine/${_pkgver}/alpha${_pkgverb}/Godot_v${_pkgver}-alpha${_pkgverb}_win64.exe.zip")
sha512sums+=("SKIP")
package_godot4-alpha-win64-bin(){
	pkgdesc+=" Alpha Windows Binary Version 64b"
	groups+=(
		"godot-win"
		"godot-win64"
		"godot-64"
	)
	install -Dm755 "${srcdir}/Godot_v${_pkgver}-alpha${_pkgverb}_win64.exe" "${pkgdir}/opt/godot/godot4-alpha-win64-bin.exe"
	install -Dm755 "${srcdir}/Godot_v${_pkgver}-alpha${_pkgverb}_win64_console.cmd" "${pkgdir}/opt/godot/godot4-alpha-win64-bin.cmd"
}

source+=("https://downloads.tuxfamily.org/godotengine/${_pkgver}/alpha${_pkgverb}/Godot_v${_pkgver}-alpha${_pkgverb}_android_editor.apk")
noextract+=("Godot_v${_pkgver}-alpha${_pkgverb}_android_editor.apk")
sha512sums+=("SKIP")
package_godot4-alpha-android-bin(){
	pkgdesc+=" Alpha Android Binary Version"
	groups+=(
		"godot-android"
	)
	install -Dm755 "${srcdir}/Godot_v${_pkgver}-alpha${_pkgverb}_android_editor.apk" "${pkgdir}/opt/godot/godot4-alpha-android-bin.apk"
}

#########
# Godot #
#########

pkgname+=(
	"godot-alpha-src"
	##################
	# Godot GDScript #
	##################
	"godot-alpha-bin"
	"godot-alpha-bin32"
	"godot-alpha-export-templates-bin"
	"libgodot-alpha-bin"
	"godot-alpha-osx-bin"
	"godot-alpha-win32-bin"
	"godot-alpha-win64-bin"
	"godot-alpha-android-bin"
	)

pkgdescalt="Godot Game Engine: An advanced, feature packed, multi-platform 2D and 3D game engine."

package_godot-alpha-src(){
	pkgdesc="${pkgdescalt} Alpha SourceCode"
	groups+=(
		"godot-src"
	)
	install -d "${pkgdir}/opt/godot/src/godot-alpha/"
	cp -r "${srcdir}/godot-${_pkgver}-alpha${_pkgverb}/"* "${pkgdir}/opt/godot/src/godot-alpha/"
}

##################
# Godot GDScript #
##################

package_godot-alpha-bin(){
	pkgdesc="${pkgdescalt} Alpha Binary Version"
	groups+=(
		"godot-standard"
		"godot-standard64"
		"godot-64"
	)
	install -Dm755 "${srcdir}/Godot_v${_pkgver}-alpha${_pkgverb}_linux.x86_64" "${pkgdir}/opt/godot/godot-alpha-bin"
	
	install -d "${pkgdir}/usr/bin/"
	ln -s "/opt/godot/godot-alpha-bin" "${pkgdir}/usr/bin/godot-alpha-bin"
	
	install -d "${pkgdir}/usr/share/applications/"
	cat > "${pkgdir}/usr/share/applications/godot-alpha-bin.desktop" <<-EOF
		[Desktop Entry]
		Name=Godot Engine Alpha Binary v${_pkgver}-alpha${_pkgverb}
		GenericName="Advanced cross-platform 2D and 3D libre game engine. Alpha Binary Version"
		Comment=Application for making games
		Exec=/usr/bin/godot-alpha-bin %U
		Icon=godot
		Terminal=false
		Type=Application
		MimeType=application/x-godot-project;
		Categories=Development;IDE;
	EOF
	
}

package_godot-alpha-bin32(){
	pkgdesc="${pkgdescalt} Alpha Binary Version 32b"
	groups+=(
		"godot-standard"
		"godot-standard32"
		"godot-32"
	)
	install -Dm755 "${srcdir}/Godot_v${_pkgver}-alpha${_pkgverb}_linux.x86_32" "${pkgdir}/opt/godot/godot-alpha-bin32"
	
	install -d "${pkgdir}/usr/bin/"
	ln -s "/opt/godot/godot-alpha-bin32" "${pkgdir}/usr/bin/godot-alpha-bin32"
	
	install -d "${pkgdir}/usr/share/applications/"
	cat > "${pkgdir}/usr/share/applications/godot-alpha-bin32.desktop" <<-EOF
		[Desktop Entry]
		Name=Godot Engine Alpha Binary v${_pkgver}-alpha${_pkgverb} 32b
		GenericName="Advanced cross-platform 2D and 3D libre game engine. Alpha Binary Version 32b"
		Comment=Application for making games
		Exec=/usr/bin/godot-alpha-bin32 %U
		Icon=godot
		Terminal=false
		Type=Application
		MimeType=application/x-godot-project;
		Categories=Development;IDE;
	EOF
}

package_godot-alpha-export-templates-bin(){
	pkgdesc="${pkgdescalt} Alpha Export Templates Binary Version"
	groups+=(
		"godot-export-templates"
	)
	install -Dm755 "${srcdir}/Godot_v${_pkgver}-alpha${_pkgverb}_export_templates.tpz" "${pkgdir}/opt/godot/godot-alpha-export-templates-bin.tpz"
}

package_libgodot-alpha-bin(){
	pkgdesc="${pkgdescalt} Alpha LibGodot Binary Version"
	groups+=(
		"godot-lib"
	)
	install -Dm755 "${srcdir}/godot-lib.${_pkgver}.alpha${_pkgverb}.release.aar" "${pkgdir}/opt/godot/godot-lib/libgodot-alpha-bin.aar"
}

package_godot-alpha-osx-bin(){
	pkgdesc="${pkgdescalt} Alpha MacOSX Binary Version"
	groups+=(
		"godot-osx"
		"godot-osx-universal"
	)
	install -Dm755 "${srcdir}/Godot.app/Contents/MacOS/Godot" "${pkgdir}/opt/godot/godot-alpha-osx-bin"
}

package_godot-alpha-win32-bin(){
	pkgdesc="${pkgdescalt} Alpha Windows Binary Version 32b"
	groups+=(
		"godot-win"
		"godot-win32"
		"godot-32"
	)
	install -Dm755 "${srcdir}/Godot_v${_pkgver}-alpha${_pkgverb}_win32.exe" "${pkgdir}/opt/godot/godot-alpha-win32-bin.exe"
	install -Dm755 "${srcdir}/Godot_v${_pkgver}-alpha${_pkgverb}_win32_console.cmd" "${pkgdir}/opt/godot/godot-alpha-win32-bin.cmd"
}

package_godot-alpha-win64-bin(){
	pkgdesc="${pkgdescalt} Alpha Windows Binary Version 64b"
	groups+=(
		"godot-win"
		"godot-win64"
		"godot-64"
	)
	install -Dm755 "${srcdir}/Godot_v${_pkgver}-alpha${_pkgverb}_win64.exe" "${pkgdir}/opt/godot/godot-alpha-win64-bin.exe"
	install -Dm755 "${srcdir}/Godot_v${_pkgver}-alpha${_pkgverb}_win64_console.cmd" "${pkgdir}/opt/godot/godot-alpha-win64-bin.cmd"
}

package_godot-alpha-android-bin(){
	pkgdesc="${pkgdescalt} Alpha Android Binary Version"
	groups+=(
		"godot-android"
	)
	install -Dm755 "${srcdir}/Godot_v${_pkgver}-alpha${_pkgverb}_android_editor.apk" "${pkgdir}/opt/godot/godot-alpha-android-bin.apk"
}